<?php
// ------------------------------------------------------------------------------------
// Bestand:       User
// Versie:        1.0
// Projekt:       Cursus MasterClass van Eduvision
// Datum:         14-07-2008
// Auteur(s):     Ronald Obbens
// Email(s):      ronaldobbens@gmail.com
// Revisie(s):	  
//
// Beschrijving:  the user class changes en gets the user stuf
// ------------------------------------------------------------------------------------
//
require_once('Query.php');

class User extends Query 
{
	private $m_iId;
	private $m_sUsername;
	private $m_sPassword;
	private $m_sRole;
	private $m_sRealname;
	private $m_sEmail;
	private $m_dBirthdate;
	private $m_sRegistrationDate;
	private $m_sRegistrationIP;
	private $m_sRegisterhash;

	public function __construct()
	{
		$this->setTable('Users');
	}
	
	/**
	 * Set the primairy key in the query
	 *
	 * @param unknown_type $p_iId
	 */
	public function setByParentId($p_iId)
	{
		$this->setPrimairyKey($p_iId);
		
		$this->m_iId = $this->get('id');
		$this->m_sUsername = $this->get('username');
		$this->m_sPassword = $this->get('password');
		$this->m_sRole = $this->get('role');
		$this->m_sRealname = $this->get('realname');
		$this->m_dBirthdate = $this->get('birthdate');
		$this->m_sEmail = $this->get('email');
		$this->m_sRegistrationDate = $this->get('regdate');
		$this->m_sRegistrationIP = $this->get('regip');
		$this->m_sRegisterhash = $this->get('registerhash');
	}
		
	/**
	 * Returns the current userid
	 *
	 * @return integer
	 */
	public function getId()
	{
		return $this->m_iId;
	}
	
	/**
	 * Returns the username of the current user
	 *
	 * @return String
	 */
	public function getUsername()
	{
		return $this->m_sUsername;
	}
	
	/**
	 * Set the username of an user
	 *
	 * @param String $p_sUsername
	 * @return unknown
	 */
	public function setUsername($p_sUsername)
	{
		$this->set('username',$p_sUsername);
		return $this->m_sUsername = $p_sUsername;
		
	}
	
	/**
	 * Get the password of a user
	 *
	 * @return String
	 */
	public function getPassword()
	{
		return $this->m_sPassword;
	}
	
	/**
	 * Set a password of a user
	 *
	 * @param String $p_sPassword
	 * @return 
	 */
	public function setPassword($p_sPassword)
	{
		$this->set('password',$p_sPassword);
		return $this->m_sPassword = $p_sPassword;
	}
	
	/**
	 * Get the securitylevel
	 *
	 * @return unknown
	 */
	public function getRole()
	{	
		return $this->m_sRole;
	}
	
	/**
	 * Set the securitylevel
	 *
	 * @param unknown_type $p_sRole
	 * @return unknown
	 */
	public function setRole($p_sRole)
	{
		$this->set('role',$p_sRole);
		return $this->m_sRole = $p_sRole;
	}
	
	/**
	 * get the real name of an user
	 *
	 * @return string
	 */
	public function getRealname()
	{
		return $this->m_sRealname;
	}
	
	/**
	 * Set the real name of an user
	 *
	 * @param string $p_sRealname
	 */
	public function setRealname($p_sRealname)
	{
		$this->set('realname',$p_sRealname);
		return $this->m_sRealname = $p_sRealname;
	}
	
	/**
	 * get email adress of the user
	 *
	 * @return string
	 */
	public function getEmail()
	{
		return $this->m_sEmail;
	}
	
	/**
	 * set the email adress of the user
	 *
	 * @param string $p_sEmail
	 */
	public function setEmail($p_sEmail)
	{
		$this->set('email',$p_sEmail);
		return $this->m_sEmail = $p_sEmail;
	}
	
	/**
	 * Get the birthdate of a user
	 *
	 * @return timestamp
	 */
	public function getBirthdate()
	{
		return $this->m_dBirthdate;
	}
	
	/**
	 * set the birthday of the user
	 *
	 * @param timestamp $p_sBirthday
	 */
	public function setBirthdate($p_sBirthday)
	{
		$this->set('birthday',$p_sBirthday);
		return $this->m_dBirthdate = $p_sBirthday;
	}
	
	/**
	 * get the registrationdate of the user
	 *
	 * @return timestamp
	 */
	public function getRegistrationDate()
	{
		return $this->m_sRegistrationDate;
	}
	
	/**
	 * Set the registrationdate of the user
	 *
	 * @param unknown_type $p_sRegistrationDate
	 * @return unknown
	 */
	public function setRegistrationDate($p_sRegistrationDate)
	{
		$this->set('date',$p_sRegistrationDate);
		return $this->m_sRegistrationDate = $p_sRegistrationDate;
	}

	/**
	 * get registration IP of the contact
	 *
	 * @return string
	 */
	public function getRegistrationIP()
	{
		return $this->m_sRegistrationIP;
	}
	
	/**
	 * set the registration IP of the contact
	 *
	 * @param string $p_sRegistrationIP
	 */
	public function setRegistrationIP($p_sRegistrationIP)
	{	
		$this->set('registrationip',$p_sRegistrationIP);
		return $this->m_sRegistrationIP = $p_sRegistrationIP;
	}

	/**
	 * get the registerhash
	 *
	 * @return string
	 */
	public function getRegisterHash()
	{
		return $this->m_sRegisterhash;
	}
	
	/**
	 * set the registerhash
	 *
	 * @param string $p_sRegisterHash
	 */
	public function setRegisterHash($p_sRegisterHash)
	{	
		$this->set('registerhash');
		return $this->m_sRegisterhash = $p_sRegisterHash;
	}
}
?>